package com.zxj.controller;


import com.seventh.common.pojo.R;
import com.zxj.pojo.entity.TbCar;
import com.zxj.pojo.vo.OperVo;
import com.zxj.service.CarService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-fifth
 * @description:
 * @author: 张修杰
 * @create: 2021-07-23 11:48
 **/
@RestController
@RequestMapping("/lease/car")
public class CarController {
    @Resource
    CarService carService;

    @ApiOperation(value = "初始化汽车查询信息")
    @PostMapping("initCarTable/{currentpage}/{pagesize}")
    public R initCarTable(@PathVariable("currentpage") Integer currentpage,
                          @PathVariable("pagesize") Integer pagesize,
                          @RequestBody OperVo operVo){
        return carService.findAllCarPage(currentpage,pagesize,operVo);
    }
    @ApiOperation(value = "修改汽车信息")
    @PutMapping("updateCarById")
    public R updateCarById(@RequestBody TbCar tbCar){
        return carService.updateCarById(tbCar);
    }

    @ApiOperation(value = "修改回显 汽车信息")
    @GetMapping("selectCarById/{id}")
    public R selectCarById(@PathVariable String id){
        return carService.selectCarById(id);
    }
    @ApiOperation(value = "新增汽车信息")
    @PutMapping("insertCar")
    public R insertCar(@RequestBody TbCar tbCar){
        return carService.insertCar(tbCar);
    }
    @ApiOperation(value = "删除汽车信息")
    @GetMapping("deleteCar/{id}")
    public R deleteCar(@PathVariable String id){
        return carService.deleteCar(id);
    }
    @ApiOperation(value = "汽车信息")
    @GetMapping("selectAllCar")
    public R selectAllCar(){ return carService.selectAllCar();}
    @ApiOperation(value = "汽车牌")
    @PostMapping("selectVin")
    public R selectVin(@RequestBody TbCar tbCar){
        return carService.selectVin(tbCar);
    }

}
